#include <bits/stdc++.h>
#define ll long long
using namespace std;

int n,tot;
bool vis[1000];
struct node{
	int x,y,z;
}E[1000];
int c;

int main(){
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	scanf("%d",&n);
	if(n<=40){
		cout<<2<<" "<<n+1<<endl;
		for(int i=0;i<=n;i++) cout<<1<<" "<<114<<" "<<i<<endl;
		return 0;
	}
	
	int nx=n,len=0;
	while(nx) len++,nx/=2;
	vis[1]=vis[2]=1;
	E[++c]=(node){1,2,0};
	int pw=1;
	for(int i=1;i<len;i++) pw*=2;
	for(int i=1;i<=len-2;i++){
		pw/=2;
		vis[i+1]=vis[i+2]=1;
		E[++c]=(node){i+1,i+2,0};
		E[++c]=(node){i+1,i+2,pw};
	}
	vis[len]=vis[114]=1;
	E[++c]=(node){len,114,1};
	E[++c]=(node){len,114,0};	
	
	int lst=1,tot=len;
	for(int i=len;~i;i--){
		if(n>>i&1){
			++tot;
			E[++c]=(node){lst,tot,(1<<i)};
			vis[lst]=vis[tot]=vis[1<<i]=1;	
			lst=tot;
			bool tag=0;
			for(int j=i-1;~j;j--){
				if(n>>j&1){
					int nxt=len-j+1;
					if(!j) nxt=114;
					E[++c]=(node){tot,nxt,0};
					vis[tot]=vis[nxt]=1;
					tag=1;
					break;
				}
			}
			if(!tag){
				vis[tot]=vis[114]=1;
				E[++c]=(node){tot,114,0};
			}
		}
	}
	int nn=0;
	for(int i=1;i<=114;i++) nn+=vis[i];
	cout<<nn<<' '<<c<<endl;
	for(int i=1;i<=c;i++) cout<<E[i].x<<" "<<E[i].y<<" "<<E[i].z<<endl;

	return 0;
}

